<a href="admin/modules/tangra_cms/category/categories.php?parent_category=0" class="action_back">Back to categories list</a><br />
<br />
<a href="admin/modules/tangra_cms/vpage/vpage_edit.php/?vpage_add_new=1" class="action_add">Create new virtual page in category &quot;{$category->get_title()}&quot;</a>
&nbsp;&nbsp;
<a href="admin/modules/tangra_cms/vpage/vpage_ordering.php?reset=1" style="background-image: url(/img/modules/tangra_cms/ordering_reset.png); background-repeat:no-repeat;padding-left: 18px;padding-top: 1px;" {popup text="Reset ordering means to remove ordering infomation for this category for all pages. That way pages will appear in reverse order of creation (e.g. latest pages will show first). You can later add again ordering information with &quot;Recalc ordering&quot;."}>Reset ordering for all pages</a>
&nbsp;&nbsp;
<a href="admin/modules/tangra_cms/vpage/vpage_ordering.php?recalc=1"  style="background-image: url(/img/modules/tangra_cms/ordering_recalc.png); background-repeat:no-repeat;padding-left: 18px;padding-top: 1px;" {popup text="Recalculate ordering will add ordering information to all pages in current category."}>Recalculate ordering for all pages</a><br />
<br />
<script type="text/javascript">
// ********************* Grid category_content START
var _tm = '{$_tm}';
var _transit_vars_par = ''{foreach from=$_transit_vars item=tvar_value key=tvar_key} + '&' + '{$tvar_key}={$tvar_value}'{/foreach};
var category_content_additional_parameters_par = ''{foreach from=$category_content_additional_parameters item=ap_var_value key=ap_var_key} + '&' + '{$ap_var_key}={$ap_var_value}'{/foreach};
{literal}
function submit_ajax_grid_category_content(page) {
{/literal}
	var pars = 'category_content_grid_page=' + page + '&' + '_tm=' + _tm + _transit_vars_par + category_content_additional_parameters_par;
{literal}
	fade_out_div();
	var myAjax = new Ajax.Request(
                                    "ajax/modules/tangra_cms/grids/category_content_grid.php",
                                    {
                                                method: 'get',
                                                onComplete: category_content_result,
                                                onSuccess: category_content_on_success,
                                                onFailure: category_content_on_failure,
												parameters: pars
                                    }          );
}


function category_content_result(req, json) {
	if (json) {
		var old_tm = _tm;
		_tm = json._tm;

		// refreshing _tm on all links that are outside of updated area
		for (var i=0; i < document.links.length; i++) {
 		  	document.links[i].href = document.links[i].href.replace(old_tm, _tm);
		}


		if (json.result_code == 1) { // OK
				switch(json.command) {
					case 'redirect':
						window.location = json.command_value;
						break;
					case 'show' :
					default :
						grid_div = $('category_content_grid_div');
						grid_div.innerHTML = req.responseText;
						break;
				}
		} else {
				// something is wrong
				if (_site_mode == 0) {
					//if in development mode - show the output anyway (if any).
					grid_div = $('category_content_grid_div');
					grid_div.innerHTML = req.responseText;
				}
		}
	} else {
		// no result_code, some serious error/exception occured.
		if (_site_mode == 1) {
			window.location = _server_error_page;
		} else {
			//if in development mode - show the output anyway (if any).
			grid_div = $('category_content_grid_div');
			grid_div.innerHTML = req.responseText;
		}
	}
}


function fade_out_div() {
	var overlay = $('category_content_overlay');
	var grid_div = $('category_content_grid_div');

	Position.clone(grid_div, overlay)
	var image = $('category_content_waiting');

	overlay.style.display = 'block';
	var image_top_offset = Math.round((overlay.offsetHeight - image.height) / 2);
	image.style.marginTop = image_top_offset + 'px';
}


function fade_in_div() {
	var overlay = $('category_content_overlay');
	overlay.style.display = 'none';
}


function category_content_on_success() {
	fade_in_div();
}


function category_content_on_failure() {
	fade_in_div();
}


function category_content_page_change(page) {
	submit_ajax_grid_category_content(page);
}


{/literal}
// ********************* Grid category_content END
</script>
<div id="category_content_grid_div">
{include file="modules/tangra_cms/grids/category_content_grid.tpl"}
</div>
<div class="metallic_ajax_overlay_grid" id="category_content_overlay" style="display:none; position: absolute; z-index: 90;" align="center"><img src="img/modules/grid_html_tpl_static_ajax_metallic/indicator_medium.gif" onclick="return true;" id="category_content_waiting" alt="" /></div>
